<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        Array.prototype.aaa = function () { }
        Array.prototype.bbb = function () { }

        let arr = ['az', 'lisi', 'ss']
        arr.age = 19;

        console.log(arr)

        for (var key in arr) {
            console.log(key + ':' + arr[key])
        }

        console.log('--------------')
        for (var key in arr) {
            if (arr.hasOwnProperty(key)) {
                console.log(arr.hasOwnProperty(key))
                console.log(key + ':' + arr[key])
            }
        }

        /*   for (var key in arr) {
              if (arr.hasOwnProperty()) {
                  console.log(key)
              }
          } */

        //for in 中 key是索引
        console.log('--------------')

        for (let key of arr) {
            console.log(key)
        }
        //for of 中 key是值
    </script>
</body>

</html>